Calling toList()
on a Flow
collects all of the objects emitted by the Flow
and returns them to you in a List
. Similarly, toSet()
collects the objects
and gives you a Set
. These handle zero, one, or several emitted objects
(unlike functions like single()
or first()
).
You can learn more about this in:
Tags: